<?php


namespace app\common\validate\api;
use think\Validate;

class LoginValidate extends Validate
{
    protected $rule = [
        "mobile" => ['require','mobile'],
        "code" =>   ['require'],
        /*'member_id'    => ['require'],
        'username'     => ['require', 'alphaDash', 'checkUsername', 'length' => '2,32'],
        'nickname'     => ['checkNickname', 'length' => '1,32'],
        'password'     => ['require', 'alphaNum', 'length' => '6,18'],
        'password_old' => ['require', 'checkPwdOld'],
        'password_new' => ['require', 'alphaNum', 'length' => '6,18'],
        'mobile'       => ['mobile', 'checkPhone',"require"],
        'email'        => ['email', 'checkEmail'],
        'avatar'       => ['require', 'file', 'image', 'fileExt' => 'jpg,png,gif,jpeg', 'fileSize' => '102400'],*/
    ];

    // 错误信息
    protected $message = [
        'mobile.require'      => '手机号必须唯一',
        'mobile.mobile'       => '手机号格式不正确',
        'code.require'        => '验证码必须',
        /* 'username.alphaDash'    => '账号由字母、数字、下划线、破折号组成',
         'nickname.require'      => '请输入昵称',
         'nickname.length'       => '昵称长度为1至32个字符',
         'password.require'      => '请输入密码',
         'password.length'       => '密码长度为6至18个字符',
         'password.alphaNum'     => '密码只能为数字和字母',
         'password_old.require'  => '请输入旧密码',
         'password_new.require'  => '请输入新密码',
         'password_new.length'   => '新密码长度为6至18个字符',
         'password_new.alphaNum' => '新密码只能为数字和字母',
         'phone.mobile'          => '请输入正确的手机号码',
         'email.email'           => '请输入正确的邮箱地址',
         'avatar.require'        => '请选择图片',
         'avatar.file'           => '请选择图片文件',
         'avatar.image'          => '请选择图片格式文件',
         'avatar.fileExt'        => '请选择jpg、png格式图片',
         'avatar.fileSize'       => '请选择大小小于100kb图片',*/
    ];

    // 验证场景
    protected $scene = [
        'id'       => ['mobile','code'],
       /* 'info'     => ['member_id'],
        'add'      => ['username', 'nickname', 'password', 'phone', 'email'],
        'edit'     => ['member_id', 'username', 'nickname', 'phone', 'email'],
        'dele'     => ['member_id'],
        'pwd'      => ['member_id', 'password'],
        'editpwd'  => ['member_id', 'password_old', 'password_new'],
        'editpwd1' => ['member_id', 'password_new'],
        'disable'  => ['member_id'],
        'avatar'   => ['avatar'],
        'register' => ['username', 'nickname', 'password', 'phone', 'email'],
        'login'    => ['username', 'password'],
        'logout'   => ['member_id'],*/
    ];

}
